define(function (require, exports, module) {
    'use strict';
    var base = require('js/utils/model'),
        moment = require('moment'),
        _ = require('underscore');

    exports.Activity = base.Model.extend({
        defaults: {
            id: '',
            activity_type: 1,
            term: '',
            number: '',
            reference: '',
            status: 1,
            start_ts: 0,
            end_ts: 0,
            announce_ts: 0,
            created_at: '',
            updated_at: ''
        },
        urlRoot: "/admin/activity/",
    });
    exports.ActivityCollection = base.Collection.extend({
        model: exports.Activity,
        url: "/admin/activity/",
    });

    exports.ActivityOrder = base.Model.extend({
        defaults: {
            id: '',
            activity_type: 1,
            term: '',
            type: '',
            track_id: 0,
            track_status: 0,
            number: '',
            status: 1,
            created_at: '',
            updated_at: ''
        },
        urlRoot: "/admin/activity/order/",
    });
    exports.ActivityOrderCollection = base.Collection.extend({
        model: exports.ActivityOrder,
        url: "/admin/activity/order/",
    });

    exports.ChargeCard = base.Model.extend({
        defaults: {
            user_id: 0,
            order_id: '',
            card_info: []
        },
        urlRoot: '/admin/order/charge_card/',
    });
    exports.CardStock = base.Model.extend({
        defaults: {
            list: []
        },
        urlRoot: '/admin/goods/stock/',
    });

    exports.Show = base.Model.extend({
        defaults: {
            template_id: null,
            template_name: '',
            term_number: null,
            order_id: null,
            user_id: null,
            status: 1,
            content: '',
            images: '',
            verify_comment: '',
            verify_award: 0,
            highlight: 0
        },
        urlRoot: "/admin/show/",
    });
    exports.ShowCollection = base.Collection.extend({
        model: exports.Show,
        url: "/admin/show/",
    });

    exports.Category = base.Model.extend({
        defaults: {
            name: '',
            icon: '',
            tag: '',
            order: 0,
            created_at: '',
            updated_at: ''
        },
        urlRoot: '/admin/category/'
    });
    exports.CategoryCollection = base.Collection.extend({
        model: exports.Category,
        url: '/admin/category/',
        total: 0,
        idNameDct: {},
        parse: function (response) {
            this.total = response.data.total_count;
            var that = this;
            _.each(response.data.list, function (item) {
                that.idNameDct[item.id] = item.name;
            });
            return response.data.list;
        }
    });

    exports.Virtual = base.Model.extend({
        defaults: {
            nick_name: '',
            avatar_id: '',
            ip: '',
            phone: '',
            deleted: 0,
            created_at: '',
            updated_at: ''
        },
        urlRoot: '/admin/virtual',
    });
    exports.VirtualCollection = base.Collection.extend({
        model: exports.Virtual,
        url: '/admin/virtual',
        total: 0,
        unused_avatar_count: '',
        parse: function (response) {
            this.total = response.data.total_count;
            this.unused_avatar_count = response.data.unused_avatar_count;
            return response.data.list;
        }
    });

    exports.ABTest = base.Model.extend({
        defaults: {
            name: '',
            created_at: '',
            updated_at: ''
        },
        urlRoot: '/admin/abtest/',
    });
    exports.ABTestCollection = base.Collection.extend({
        model: exports.ABTest,
        url: '/admin/abtest/',
    });

    exports.Feedback = base.Model.extend({
        defaults: {
            user_id: '',
            nick_name: '',
            qq: '',
            phone: '',
            content: '',
            chn: '',
            cvc: '',
            created_at: '',
            updated_at: ''
        },
        urlRoot: '/admin/feedback/',
    });
    exports.FeedbackCollection = base.Collection.extend({
        model: exports.Feedback,
        url: '/admin/feedback/',
    });

    exports.Notification = base.Model.extend({
        defaults: {
            content: {
                title: '',
                content: '',
            },
            extend: {
                filter_list: [],
                alert: {
                    image: '',
                    cmd: ''
                }
            },
            status: 0,
            expire_ts: null,
            created_at: '',
            updated_at: ''
        },
        urlRoot: '/admin/notification/',
    });
    exports.NotificationCollection = base.Collection.extend({
        model: exports.Notification,
        url: '/admin/notification/',
    });

/*站内消息*/
    exports.NotifyInternal = base.Model.extend({
        defaults: {

        },
        urlRoot: '/admin/notification/',
    });
    exports.NotifyInternalCollection = base.Collection.extend({
        model: exports.NotifyInternal,
        url: '/admin/notification/',
    });

    exports.InAppAnnouncement = base.Model.extend({
        defaults: {
            title: "",
            content: "",
            start_ts: moment().unix() + 1000,
            end_ts: moment().unix() + 1000
        },
        urlRoot: '/admin/in_app_announcement/'
    });
    exports.InAppAnnouncementCollection = base.Collection.extend({
        model: exports.InAppAnnouncement,
        url: '/admin/in_app_announcement/'
    });
    exports.XingeNotification = base.Model.extend({
        defaults: {
            title: '',
            content: '',
            push_device: 0,
            send_time: '',
            cmd: '',
            status: 0,
            created_at: '',
            updated_at: ''
        },
        urlRoot: '/admin/xinge_notification/',
    });
    exports.XingeNotificationCollection = base.Collection.extend({
        model: exports.Notification,
        url: '/admin/xinge_notification/',
    });

    exports.Withdraw = base.Model.extend({
        defaults: {
            user_id: '',
            price: 0,
            balance: 0,
            status: 1,
            withdraw_type: 10,
            withdraw_info: null,
            created_at: '',
            updated_at: ''
        },
        urlRoot: "/admin/withdraw/",
    });
    exports.WithdrawCollection = base.Collection.extend({
        model: exports.Withdraw,
        url: "/admin/withdraw/",
    });

    exports.Coupon = base.Model.extend({
        defaults: {
            // user_id: '',
            // created_at: '',
            // updated_at: ''
        },
        urlRoot: "/admin/coupon/",
    });
    exports.CouponCollection = base.Collection.extend({
        model: exports.Coupon,
        url: "/admin/coupon/",
        parse: function (response) {
          this.total = response.data.total_count;
          this.page = response.data.page;
          this.size = response.data.size;
          this.unuse_count = response.data.unuse_count;
          this.unuse_price = response.data.unuse_price;
          this.used_count = response.data.used_count;
          this.used_price = response.data.used_price;
          this.expire_count = response.data.expire_count;
          this.expire_price = response.data.expire_price;
          return response.data.data;
        }
    });

    exports.WithdrawAccount = base.Model.extend({
        defaults: {
            user_id: '',
            no: '',
            name: '',
            count: 0,
            amount: 0,
            created_at: '',
            updated_at: ''
        },
        urlRoot: "/admin/withdraw/account/",
    });
    exports.WithdrawAccountCollection = base.Collection.extend({
        model: exports.Withdraw,
        url: "/admin/withdraw/account/",
    });

    exports.AccountBlack = base.Model.extend({
        defaults: {},
        urlRoot: '/admin/account/get_black_account/',
    });
    exports.AccountBlackCollection = base.Collection.extend({
        model: exports.AccountBlack,
        url: '/admin/account/get_black_account/',
    });

    exports.Order = base.Model.extend({
        defaults: {
            user_id: '',
            activity_type: 1,
            order_id: 1,
            status: 0,
            detail: {},
            created_at: '',
            updated_at: ''
        },
        urlRoot: "/admin/order/",
    });
    exports.OrderCollection = base.Collection.extend({
        model: exports.Order,
        url: '/admin/order/',
    });

    exports.GameOrder = base.Model.extend({
        defaults: {},
        urlRoot: "/admin/casino_records/",
    });
    exports.GameOrderCollection = base.Collection.extend({
        model: exports.GameOrder,
        url: '/admin/casino_records/',
        parse: function (response) {
            this.total = response.data.total_count;
            this.page = response.data.page;
            this.size = response.data.size;
            this.bet_total = response.data.bet_total;
            this.award_total = response.data.award_total;
            return response.data.list;
        }
    });

    exports.CouponTemplate = base.Model.extend({
        defaults: {
            title: "",
            coupon_type: 1,
            desc: "",
            price: 0,
            condition_price: 0,
            valid_ts: 3 * 24 * 60 * 60,
            activity_type: '',
            cmd: '',
            remark: '',
            created_at: '',
            updated_at: ''
        },

        urlRoot: '/admin/coupon/template/',
    });
    exports.CouponTemplateCollection = base.Collection.extend({
        model: exports.CouponTemplate,
        url: '/admin/coupon/template/',
    });

    exports.Recharge = base.Model.extend({
        defaults: {
            user_id: '',
            pay_amount: 0,
            status: 1,
            recharge_type: 10,
            recharger_info: null,
            rechargee_info: null,
            created_at: '',
            updated_at: ''
        },
        urlRoot: "/admin/recharge/apply/",
    });
    exports.RechargeCollection = base.Collection.extend({
        model: exports.Recharge,
        url: "/admin/recharge/apply/",
    });


    /*充值订单管理*/
    exports.AddRechargeOrder = base.Model.extend({
        defaults: {
        },
        urlRoot: "/admin/stats/pay/",
    });
    exports.AddRechargeOrderCollection = base.Collection.extend({
        model: exports.AddRechargeOrder,
        url: "/admin/stats/pay/",
    });

    exports.RechargeStatus = base.Model.extend({
        defaults: {
            on: 0,
        },
        urlRoot: "/admin/recharge/checkstatus/",
    });

    exports.Bull = base.Model.extend({
        defaults: {},
        urlRoot: '/admin/bull/'
    });
    exports.BullCollection = base.Collection.extend({
        model: exports.Bull,
        url: '/admin/bull/'
    });
    exports.BullPart = base.Model.extend({
        defaults: {},
        urlRoot: '/admin/bull_part/'
    });
    exports.BullPartCollection = base.Collection.extend({
        model: exports.BullPart,
        url: '/admin/bull_part/'
    });
    exports.Lottery = base.Model.extend({
        defaults: {},
        urlRoot: '/admin/lottery/'
    });
    exports.LotteryCollection = base.Collection.extend({
        model: exports.Lottery,
        url: '/admin/lottery/'
    });
    exports.Fruit = base.Model.extend({
        defaults: {},
        urlRoot: '/admin/fruit/'
    });
    exports.FruitCollection = base.Collection.extend({
        model: exports.Fruit,
        url: '/admin/fruit/'
    });
    exports.LotteryPart = base.Model.extend({
        defaults: {},
        urlRoot: '/admin/lottery_part/'
    });
    exports.LotteryPartCollection = base.Collection.extend({
        model: exports.LotteryPart,
        url: '/admin/lottery_part/'
    });
    exports.FruitPart = base.Model.extend({
        defaults: {},
        urlRoot: '/admin/fruit_part/'
    });
    exports.FruitPartCollection = base.Collection.extend({
        model: exports.LotteryPart,
        url: '/admin/fruit_part/'
    });
    exports.RechargeWechat = base.Model.extend({
        defaults: {},
        urlRoot: '/admin/recharge/wechat/',
    });
    exports.RechargeWechatCollection = base.Collection.extend({
        model: exports.RechargeWechat,
        url: '/admin/recharge/wechat/'
    });
    exports.MetisOrder = base.Model.extend({
        defaults: {
        },
        urlRoot: '/admin/metis_order/'
    });
    exports.MetisOrderCollection = base.Collection.extend({
        model: exports.MetisOrder,
        url: '/admin/metis_order/',
        parse: function (response) {
            this.total = response.data.total_count;
            this.page = response.data.page;
            this.size = response.data.size;
            this.total_bet = response.data.total_bet;
            this.total_win = response.data.total_win;
            return response.data.list;
        }
    });
    exports.AddCoin = base.Model.extend({
        defaults: {
        },
        urlRoot: '/admin/system_recharge'
    });
    exports.AddCoinCollection = base.Collection.extend({
        model: exports.AddCoin,
        url: '/admin/system_recharge'
    });
    exports.WithdrawBlack = base.Model.extend({
        defaults: {},
        urlRoot: "/admin/withdraw/black/get"
    });
    exports.WithdrawBlackCollection = base.Collection.extend({
        model: exports.WithdrawBlack,
        url: '/admin/withdraw/black/get'
    });
    exports.MetisTiger = base.Model.extend({
        defaults: {
        },
        urlRoot: '/admin/metis_game/'
    });
    exports.MetisTigerCollection = base.Collection.extend({
        model: exports.MetisTiger,
        url: '/admin/metis_game/'
    });
    exports.MetisTigerPart = base.Model.extend({
        defaults: {
        },
        urlRoot: '/admin/metis_game_part/'
    });
    exports.MetisTigerPartCollection = base.Collection.extend({
        model: exports.MetisTigerPart,
        url: '/admin/metis_game_part/',
        parse: function (response) {
            this.total = response.data.total_count;
            this.page = response.data.page;
            this.size = response.data.size;
            this.total_bet = response.data.total_bet;
            this.total_win = response.data.total_win;
            return response.data.list;
        }
    });
    exports.MetisSix = base.Model.extend({
        defaults: {
        },
        urlRoot: '/admin/metis_game/'
    });
    exports.MetisSixCollection = base.Collection.extend({
        model: exports.MetisSix,
        url: '/admin/metis_game/'
    });
    exports.MetisSixPart = base.Model.extend({
        defaults: {
        },
        urlRoot: '/admin/metis_game_part/'
    });
    exports.MetisSixPartCollection = base.Collection.extend({
        model: exports.MetisSixPart,
        url: '/admin/metis_game_part/',
        parse: function (response) {
            this.total = response.data.total_count;
            this.page = response.data.page;
            this.size = response.data.size;
            this.total_bet = response.data.total_bet;
            this.total_win = response.data.total_win;
            return response.data.list;
        }
    });
    exports.MetisDailyBet = base.Model.extend({
        defaults: {
            user_id: '',
            created_at: '',
            updated_at: ''
        },
        urlRoot: "/admin/metis_daily_bet/",
    });
    exports.MetisDailyBetCollection = base.Collection.extend({
        model: exports.MetisDailyBet,
        url: "/admin/metis_daily_bet/",
    });
});
